﻿using System;
using System.Collections.Generic;

namespace IoCTechDay.MAC
{
    public class MAC
    {
        private readonly Dictionary<Type, object> _container;

        public MAC()
        {
            _container = new Dictionary<Type, object>();
        }

        public void Register<T>(Func<T> factory)
        {
            _container.Add(typeof(T), factory);
        }

        public T Get<T>()
        {
            Func<T> factory = _container[typeof (T)] as Func<T>;
            return factory.Invoke();
        }

        static void Test()
        {
            
        }
    }
}
